package org.bonorsoft.modules.education.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.bonorsoft.modules.education.entity.Addressee;
import org.bonorsoft.modules.education.mapper.AddresseeMapper;
import org.bonorsoft.modules.education.service.IAddresseeService;
import org.bonorsoft.modules.education.vo.NoticeVo;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * @Description: 收件人表
 * @Author: WilliamYe
 * @Date:   2021-06-22
 * @Version: V1.0
 */
@Service
public class AddresseeServiceImpl extends ServiceImpl<AddresseeMapper, Addressee> implements IAddresseeService {

    @Override
    public boolean add(String noticeId, String addresseeName) {
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        return this.baseMapper.add(uuid, noticeId, addresseeName);
    }

    @Override
    public List<Addressee> getByNoticeId(String noticeId) {
        return this.baseMapper.getByNoticeId(noticeId);
    }

    @Override
    public List<Addressee> getYesByNotice(String noticeId) {
        return this.baseMapper.getYesByNotice(noticeId);
    }

    @Override
    public List<Addressee> getNoByNotice(String noticeId) {
        return this.baseMapper.getNoByNotice(noticeId);
    }

    @Override
    public List<Addressee> getSignByNoticeId(String noticeId) {
        return this.baseMapper.getSignByNoticeId(noticeId);
    }

    @Override
    public IPage<NoticeVo> paging(Page<NoticeVo> page, QueryWrapper<NoticeVo> queryWrapper) {
        return this.baseMapper.paging(page,queryWrapper);
    }

    @Override
    public void removeByNoticeId(String id) {
        this.baseMapper.removeByNoticeId(id);
    }

    @Override
    public Addressee getByName(String noticeId, String addresseeName) {
        return this.baseMapper.getByName(noticeId,addresseeName);
    }

    @Override
    public List<NoticeVo> mobileList(String mobile) {
        return this.baseMapper.mobileList(mobile);
    }

    @Override
    public List<NoticeVo> searchList(QueryWrapper<NoticeVo> queryWrapper, String keyWord, String startTime, String endTime) {
        return this.baseMapper.searchList(queryWrapper,keyWord,startTime,endTime);
    }
}
